package com.cadre.system;

import com.alibaba.fastjson.JSONArray;

import java.util.Map;

/* loaded from: EducationStringBuild.class */
public class EducationStringBuild extends SQLStringBuild {
    @Override // com.tdqy.cadre.modular.profess.common.SQLStringBuild
    public String builder(Map<String, Object> map) {
        StringBuilder sqlbuilder = new StringBuilder("select personid from d_persontag d where ");
        String tagid = map.get("tagId").toString();
        if (map.get("flag").toString().equals("2")) {
            sqlbuilder.append("d.tagid = ").append(tagid).append(" and ( ");
            JSONArray valuestring = (JSONArray) map.get("valueString");
            for (int i = 0; i < valuestring.size(); i++) {
                if (i == 0) {
                    sqlbuilder.append(" d.valuestring = '").append(valuestring.get(i)).append("'");
                } else {
                    sqlbuilder.append(" or d.valuestring = '").append(valuestring.get(i)).append("'");
                }
            }
            return sqlbuilder.append(")").toString();
        }
        sqlbuilder.append("d.tagid = ").append(tagid).append(" and ");
        JSONArray valuestring2 = (JSONArray) map.get("valueString");
        for (int i2 = 0; i2 < valuestring2.size(); i2++) {
            if (i2 == 0) {
                sqlbuilder.append(" d.valuestring in ('").append(valuestring2.get(i2)).append("')");
            } else {
                sqlbuilder.append(" and d.personid in (select personid from d_persontag where tagid = " + tagid + "and valuestring in('").append(valuestring2.get(i2)).append("'))");
            }
        }
        return sqlbuilder.toString();
    }
}
